<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui">
    <h:head>
        <title>MeteoCal</title>
        <link type="text/css" rel="stylesheet" href="resources/css/invitation.css" />
    </h:head>
    <body>
        <h:form>
            <p:carousel id="carousel" value="#{invitationBean.receivedin}" headerText="Received #{invitationBean.sizer()} Invitations" var="receivedin" itemStyleClass="carItem">
                    <h:panelGrid rendered="#{invitationBean.sizer() != 0}" columns="2" style="margin-bottom: 2px; position: relative;" cellpadding="5">
                    <h:outputText value="Participate?" />
                    <p:selectOneButton value="#{receivedin.response}">
                        <f:selectItem itemLabel="Yes" itemValue="Yes"  />
                        <f:selectItem itemLabel="No" itemValue="No" />
                        <f:selectItem itemLabel="Maybe" itemValue="Maybe" />
                    </p:selectOneButton>
                </h:panelGrid>
                <div>
                <h:panelGrid columns="2" columnClasses="label,value">
                        <h:outputText value="Event Name:" />
                        <h:outputText value="#{receivedin.event.name}" />

                        <h:outputText value="City:" />
                        <h:outputText value="#{receivedin.event.city}" />

                        <h:outputText value="Address:" />
                        <h:outputText value="#{receivedin.event.address}"/>

                        <h:outputText value="From:" />
                        <h:outputText value="#{receivedin.event.dateBegin.getDate()}/#{receivedin.event.dateBegin.getMonth()+1}/#{receivedin.event.dateBegin.getYear()+1900}, #{receivedin.event.hourBegin.getHours()}h #{receivedin.event.hourBegin.getMinutes()}m"/>

                        <h:outputText value="To:" />
                        <h:outputText value="#{receivedin.event.dateEnd.getDate()}/#{receivedin.event.dateEnd.getMonth()+1}/#{receivedin.event.dateEnd.getYear()+1900}, #{receivedin.event.hourEnd.getHours()}h #{receivedin.event.hourEnd.getMinutes()}m" />

                        <h:outputText value="Creator" />
                        <h:outputText value="#{receivedin.event.idCreator.name} #{receivedin.event.idCreator.surname}" />

                        <h:outputText value="Outdoor:&emsp;#{receivedin.event.outdoor==false ? 'No' : 'Yes'}" />
                        <h:outputText value="Public:&emsp;#{receivedin.event.public1==false ? 'No' : 'Yes'}" />

                    </h:panelGrid>
                </div>
            </p:carousel>
            <p:carousel value="#{invitationBean.sentin}" headerText="Sended #{invitationBean.sizes()} Invitations" var="x" itemStyleClass="carItem">
                <h:panelGrid id="sent" rendered="#{not empty x}" columns="2" columnClasses="label,value">
                    <h:outputText value="Event Name:" />
                    <h:outputText value="#{invitationBean.getName(x)}" />

                    <h:outputText value="Date_Hour:" />
                    <h:outputText value="#{invitationBean.getDate_Hour(x)}" />

                    <h:outputText value="To &laquo;User,Reply&raquo;:" />
                    <p:dataList value="#{x}" var="i" emptyMessage="" type="none">
                        <h:outputText value="&laquo;#{i.user.name} #{i.user.surname}," />
                        <h:outputText value="#{i.response}&raquo;" /><br/>
                    </p:dataList>
                </h:panelGrid>
            </p:carousel>
            <p:growl id="growl" showDetail="true" life="8000" />  
<p:commandButton style="position: absolute; right: 130px; top: 22px" update="growl carousel" value="Confirm" action="#{invitationBean.updateInvitation()}" />
          <p:commandButton style="position: absolute; right: 200px; top: 22px" update="growl carousel" value="Homepage" action="homepage?faces-redirect=true" />
  
        </h:form>
    </body>
</html>
